package com.hice.demo.dubbo.message.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.hice.demo.dubbo.message.dao.MessageDao;
import com.hice.demo.dubbo.message.model.Message;
import com.hice.demo.dubbo.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by hyson on 2017/3/13.
 */
@Component
@Service(version = "1.0.0")
public class MessageServiceImpl implements MessageService {
    @Autowired
    MessageDao messageDao;

    @Override
    public boolean add(Message message) {
        return messageDao.save(message) == null ? false : true;
    }

    @Override
    public boolean del(Long mid) {
        boolean flag = true;
        try {
            messageDao.delete(mid);
        } catch (Exception e) {
            flag = false;
        }
        return flag;
    }
}